<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>韩城市综合行政执法局业务审批管理系统</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="__ADMIN__/bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="__ADMIN__/bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="__ADMIN__/bower_components/Ionicons/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="__ADMIN__/dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="__ADMIN__/dist/css/skins/_all-skins.min.css">
  <!-- Morris chart -->
  <link rel="stylesheet" href="__ADMIN__/bower_components/morris.js/morris.css">
  <!-- jvectormap -->
  <link rel="stylesheet" href="__ADMIN__/bower_components/jvectormap/jquery-jvectormap.css">
  <!-- Date Picker -->
  <link rel="stylesheet" href="__ADMIN__/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
  <!-- Daterange picker -->
  <link rel="stylesheet" href="__ADMIN__/bower_components/bootstrap-daterangepicker/daterangepicker.css">
  <!-- bootstrap wysihtml5 - text editor -->
  <link rel="stylesheet" href="__ADMIN__/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
  <!-- 自定义样式 -->
  <link rel="stylesheet" href="__ADMIN__/css/style.css">
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
  <!-- jQuery 3 -->
  <script src="__ADMIN__/bower_components/jquery/dist/jquery.min.js"></script>
  <script src="__PLUS__/layer/layer.js"></script>
  <!-- 引入百度编辑器 -->
  <script src="__PLUS__/ueditor/ueditor.config.js"></script>
  <script src="__PLUS__/ueditor/ueditor.all.min.js"></script>
  <script src="__PLUS__/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <!-- 头部 -->
  {include file="common/header"}
  <!-- //头部 -->

  <!-- 左侧导航 -->
  {include file="common/left"}
  <!-- /左侧导航 -->

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper" style="overflow: hidden;">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
<?php
$status=input('status');
if($status==5){
echo "终审通过";
}
else{echo $status."级审核";}

?>

      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 系统</a></li>
        <li class="active">业务审核</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">业务列表</h3>


            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding ">
              <table class="table table-hover text-center">
                <tr>
                  <th>ID</th>
                  <th>编号</th>
                  <th>单位</th>
                  <th>电话</th>
                  <th>类型</th>
                  <th>区域</th>
                  <th>日期</th>
                  <th>操作</th>
                </tr>
                {volist name="list" id="vo"}
                <tr>
                  <td>{$vo.bus_id}</td>
                  <td>{$vo.bus_no}</td>
                  <td><a class="show" data-id="{$vo.bus_id}" cate-id="{$vo.cate_name}" href="javascript:;">{$vo.bus_name}</a></td>
                  <td>{$vo.bus_tel}</td>
                  <td>{$vo.cate_name}</td>
                  <td>{$vo.area_name}</td>
                  <td>{$vo.bus_create_time|date="Y-m-d",###}</td>


                  <td><div>
                    <a class="show" data-id="{$vo.bus_id}" cate-id="{$vo.cate_name}" href="javascript:;" >
                      <i class="glyphicon glyphicon-ok"></i>
                    </a>

                  </div></td>
                </tr>
                {/volist}
              </table>


            </div>
            <div style="text-align:right;margin-top:10px;">
              {$list->render()}	                </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
      </div>

    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <!-- 底部 -->
  {include file="common/footer"}
  <!-- /底部 -->
  <div id="showbox" style="display:none;">
    <table  class="table table-bordered table-hover dataTable" role="grid" aria-describedby="example2_info">
      <tbody>
      <tr role="row" class="even">
        <td style="width: 50%;"><label class="show_label">业务编号:</label><span  class="" id="no"  ></span></td>
        <td style="width: 50%;"><label class="show_label">申请单位:</label><span  class="" id="name"  ></span></td>
      </tr>
      <tr role="row" class="even">
        <td style="width: 50%;"><label class="show_label">业务类型:</label><span  class="" id="cate_id"  ></span></td>
        <td style="width: 50%;"><label class="show_label">联系电话:</label><span  class="" id="tel"  ></span></td>
      </tr>
      </tbody>
    </table>
    <div id="content" class="show_content"></div>
    <div id="kanyan_show" class="show_kanyan text-center"></div>
    <div id="message_show">
      <table class="table table-hover text-center">
        <tbody>
        <tr id="til">
          <th>审核状态</th>
          <th>审核部门</th>
          <th>审核详情</th>
          <th>审核时间</th>
        </tr>
        <!--<tr>-->
          <!--<td></td>-->
          <!--<td></td>-->
          <!--<td></td>-->
          <!--<td></td>-->
        <!--</tr>-->
        </tbody></table>
    </div>
    <div class="box-footer text-center" id="btns">



      <a class="btn btn-success" id="pass" href="javascript:;" data-id="" pname-id="" status-id="" type="submit">审核通过</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <a class="btn btn-danger " id="back" href="javascript:;" data-id="" pname-id="" status-id="" type="submit" >审核退回</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      {if condition="$Think.session.logininfo.group_id eq 9"}
      <a id="bakkanyan" href="javascript:;"  data-id="" pname-id="" status-id="" type="submit" class=" btn btn-primary">勘验单退回</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      {/if}
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


    </div>
    <!-- /.box-footer -->
  </div>


  <div id="whyback" style="display:none;">
    <div class="box-body form-horizontal">
      <div class="form-group">
        <div class="col-sm-12">
          <textarea id="msgcon"  name="msg">没有通过审核</textarea>
        </div>
      </div>
    </div>
    <div class="box-footer text-center">
      &nbsp;&nbsp;&nbsp;&nbsp;<a id="addmsg" href="javascript:;" data-id=""  status="" pname=""  type="submit" class="btn btn-success">提交</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
    <!-- /.box-footer -->

  </div>

  <div id="yijian" style="display:none;">
    <div class="box-body form-horizontal">
      <div class="form-group">
        <div class="col-sm-12">
          <textarea id="msgcont"  name="msg">审核通过</textarea>
        </div>
      </div>
    </div>
    <div class="box-footer text-center">
      &nbsp;&nbsp;&nbsp;&nbsp;<a id="addmsgt" href="javascript:;" data-id=""  status="" pname=""  type="submit" class="btn btn-success">提交</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
    <!-- /.box-footer -->

  </div>

  <!-- ./wrapper -->
  <script>
      function layer_msg(msg,icon,time){
          layer.msg(msg, {
              icon: icon,
              time: time,
              end: function () {
                  location.reload();
              }
          });
      }
// 确认是否删除
      $('.del').on('click', function(){
          var urld = $(this).attr('data-id');
          //询问框
          layer.confirm('确定要删除吗？', {
              btn: ['确认','取消'], //按钮
              title: '系统警告！'
          }, function(){
              console.log(urld);
              location.href=urld;
          });
      });
// 显示业务详情
      $('.show').on('click', function(){

          $.ajax({
              url: "{:url('business/ajaxShow')}",
              type: 'POST',
              dataType: 'json',
              data: {
                  id:$(this).attr('data-id'),
                  cate_id:$(this).attr('cate-id')
              }
          })
              .done(function(res) {
                   console.log(res);
                  if(res.ECODE== 200){

                      $('#no').text(res.MSG.base.bus_no);
                      $('#name').text(res.MSG.base.bus_name);
                      $('#tel').text(res.MSG.base.bus_tel);
                      $('#cate_id').text(res.MSG.base.cate_name);
                      $('#content').html(res.MSG.base.bus_content);
                      var kanyan_img="<img src='"+res.MSG.base.bus_thumb+"'>";
                      // $('#kanyan_show').afterAll().remove();
                      $('#kanyan_show').append(kanyan_img);
                      $('#pass').attr('pname-id',res.MSG.base.pos_name);
                      $('#pass').attr('status-id',res.MSG.base.bus_status);
                      $('#back').attr('pname-id',res.MSG.base.pos_name);
                      $('#pass').attr('data-id',res.MSG.base.bus_id);
                      $('#back').attr('status-id',res.MSG.base.bus_status);
                      $('#back').attr('data-id',res.MSG.base.bus_id);
                      $('#bakkanyan').attr('data-id',res.MSG.base.bus_id);
                      $('#bakkanyan').attr('status-id',res.MSG.base.bus_status);

                      var info = res.MSG.info;
                      var info_html = "";
                      if(info){
                          for(var i=0;i<info.length;i++){
                              var num=info[i].mstatus;
                              info_html += '<tr>';
                              info_html += num == 1 ? '<td><span class="label label-success">通过</span></td>' : '<td><span class="label label-danger">退回</span></td>';
                              info_html += '<td>'+ info[i].position_name +'</td>';
                              info_html += '<td>'+ info[i].content +'</td>';
                              info_html += '<td>'+ info[i].create_time +'</td>';
                              info_html += '</tr>';
                          }
                      }
                      $('#til').nextAll().remove();
                      $('#til').after(info_html);

                      //页面层
                      layer.open({
                          type: 1,
                          title: '业务审核',
                          skin: 'layui-layer-rim', //加上边框
                          area: ['80%','80%'], //宽高
                          content: $('#showbox')
                      });
                  }

              });
      });

      // 上传勘验单
      var doc = $(document);
      $(doc).on('click', '#addkanyan',function(){
          $.ajax({
              url: "{:url('business/ajaxKanyan')}",
              type: 'POST',
              dataType: 'json',
              data: {
                  id:$(this).attr('data-id')
              }
          })
          .done(function(res) {
              console.log(res);
              if(res.ECODE== 200){
                  $('#savekanyan').attr('data-id',res.MSG.id);
                  $('#kanyan_id').val(res.MSG.id);
                  //页面层
                  layer.open({
                      type: 1,
                      title: '上传勘验单',
                      skin: 'layui-layer-rim', //加上边框
                      area: ['70%'], //宽高
                      content: $('#kanyan'),
                  });

              }
          });
      });


      // 勘验单退回执行操作
      $('#bakkanyan').on('click', function(){
          $.ajax({
              url: "{:url('business/ajaxBackkanyan')}",
              type: 'POST',
              dataType: 'json',
              data: {
                  id:$(this).attr('data-id'),
                  status:$(this).attr('status-id'),
                  pname:$(this).attr('pname-id'),
              }
          })
              .done(function(res) {
                  console.log(res);
                  layer_msg("退回成功",1,3000);
              });
      });

  // 审核通过执行操作
      $('#pass').on('click', function(){
          $.ajax({
              url: "{:url('business/ajaxPass')}",
              type: 'POST',
              dataType: 'json',
              data: {
                  id:$(this).attr('data-id'),
                  status:$(this).attr('status-id'),
                  pname:$(this).attr('pname-id'),
              }
          })
              .done(function(res) {
                  console.log(res);
                  if(res.ECODE== 200){
                      if(res.MSG.error){
                          layer_msg(res.MSG.error,1,3000);die;
                      }
                      else {
                          $('#addmsgt').attr('data-id',res.MSG.id);
                          $('#addmsgt').attr('pname',res.MSG.pname);
                          $('#addmsgt').attr('status',res.MSG.status);
                          //页面层
                          layer.open({
                              type: 1,
                              title: '审核意见',
                              skin: 'layui-layer-rim', //加上边框
                              area: ['70%'], //宽高
                              content: $('#yijian'),
                          });
                          //layer_msg("审核成功",1,3000);
                      }

                  }
              });
      });

  // 审核退回执行操作
      $('#back').on('click', function(){

          $.ajax({
              url: "{:url('business/ajaxBack')}",
              type: 'POST',
              dataType: 'json',
              data: {
                  id:$(this).attr('data-id'),
                  status:$(this).attr('status-id'),
                  pname:$(this).attr('pname-id'),
              }
          })
              .done(function(res) {
                  console.log(res);
                  if(res.ECODE== 200){
                      if(res.MSG.error){
                          layer_msg(res.MSG.error,1,3000);die;
                      }
                      else{
                          $('#addmsg').attr('data-id',res.MSG.id);
                          $('#addmsg').attr('pname',res.MSG.pname);
                          $('#addmsg').attr('status',res.MSG.status);
                          //页面层
                          layer.open({
                              type: 1,
                              title: '退回原因',
                              skin: 'layui-layer-rim', //加上边框
                              area: ['70%'], //宽高
                              content: $('#whyback'),
                          });
                      }


                  }


              });
      });
      $('#addmsg').on('click', function(){

          $.ajax({
              url: "{:url('business/ajaxAddMsg')}",
              type: 'POST',
              dataType: 'json',
              data: {
                  id:$(this).attr('data-id'),
                  status:$(this).attr('status'),
                  content: UE.getEditor('msgcon').getContent(),
                  pname:$(this).attr('pname')
              }
          })
              .done(function(res) {
                  console.log(res);
                  if(res.ECODE== 200){

                      layer_msg("提交成功",1,2000);
                  }

              });
      });

      $('#addmsgt').on('click', function(){

          $.ajax({
              url: "{:url('business/ajaxYijian')}",
              type: 'POST',
              dataType: 'json',
              data: {
                  id:$(this).attr('data-id'),
                  status:$(this).attr('status'),
                  content: UE.getEditor('msgcont').getContent(),
                  pname:$(this).attr('pname')
              }
          })
              .done(function(res) {
                  console.log(res);
                  if(res.ECODE== 200){

                      layer_msg("提交成功",1,2000);
                  }

              });
      });




  </script>
  <script type="text/javascript">

      //实例化编辑器
      //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例

      UE.getEditor('msgcon',{initialFrameHeight:350 });
      UE.getEditor('msgcont',{initialFrameHeight:350 });
      // 提交退回原因



  </script>
  <!-- Bootstrap 3.3.7 -->
  <script src="__ADMIN__/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  <!-- Morris.js charts -->
  <script src="__ADMIN__/bower_components/raphael/raphael.min.js"></script>
  <script src="__ADMIN__/bower_components/morris.js/morris.min.js"></script>
  <!-- Sparkline -->
  <script src="__ADMIN__/bower_components/jquery-sparkline/dist/jquery.sparkline.min.js"></script>
  <!-- jvectormap -->
  <script src="__ADMIN__/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
  <script src="__ADMIN__/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
  <!-- jQuery Knob Chart -->
  <script src="__ADMIN__/bower_components/jquery-knob/dist/jquery.knob.min.js"></script>
  <!-- daterangepicker -->
  <script src="__ADMIN__/bower_components/moment/min/moment.min.js"></script>
  <script src="__ADMIN__/bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
  <!-- datepicker -->
  <script src="__ADMIN__/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
  <!-- Bootstrap WYSIHTML5 -->
  <script src="__ADMIN__/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
  <!-- Slimscroll -->
  <script src="__ADMIN__/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
  <!-- FastClick -->
  <script src="__ADMIN__/bower_components/fastclick/lib/fastclick.js"></script>
  <!-- AdminLTE App -->
  <script src="__ADMIN__/dist/js/adminlte.min.js"></script>
  <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
  <!--<script src="__ADMIN__/dist/js/pages/dashboard.js"></script>-->
  <!-- AdminLTE for demo purposes -->
  <script src="__ADMIN__/dist/js/demo.js"></script>
</body>
</html>
